<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Cadastrar Vagas</title>

  <!-- Imports -->
  <link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" />
  <script  src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"></script>
   <script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>   
<script type="text/javascript" src="jquery.maskedinput.js"></script>
<script src="SpryAssets/SpryValidationTextField.js" type="text/javascript"></script>
<script type="text/javascript">  

$(function() {
	$( '#txtDataAbertura' ).datepicker({
    dateFormat: 'dd/mm/yy',
    dayNames: ['Domingo','Segunda','Terça','Quarta','Quinta','Sexta','Sábado'],
    dayNamesMin: ['D','S','T','Q','Q','S','S','D'],
    dayNamesShort: ['Dom','Seg','Ter','Qua','Qui','Sex','Sáb','Dom'],
    monthNames: ['Janeiro','Fevereiro','Março','Abril','Maio','Junho','Julho','Agosto','Setembro','Outubro','Novembro','Dezembro'],
    monthNamesShort: ['Jan','Fev','Mar','Abr','Mai','Jun','Jul','Ago','Set','Out','Nov','Dez'],
    nextText: 'Próximo',
    prevText: 'Anterior'
	});
});
$(function() {
	$( '#txtDataInicio' ).datepicker({
    dateFormat: 'dd/mm/yy',
    dayNames: ['Domingo','Segunda','Terça','Quarta','Quinta','Sexta','Sábado'],
    dayNamesMin: ['D','S','T','Q','Q','S','S','D'],
    dayNamesShort: ['Dom','Seg','Ter','Qua','Qui','Sex','Sáb','Dom'],
    monthNames: ['Janeiro','Fevereiro','Março','Abril','Maio','Junho','Julho','Agosto','Setembro','Outubro','Novembro','Dezembro'],
    monthNamesShort: ['Jan','Fev','Mar','Abr','Mai','Jun','Jul','Ago','Set','Out','Nov','Dez'],
    nextText: 'Próximo',
    prevText: 'Anterior'
	});
});
   
function populaIdade(elemento){
	var min = 18, max = 50, select = document.getElementById(elemento);
	for(var i = min; i<=max;i++){
		var opt = document.createElement('option');
		opt.value = i;
		opt.innerHTML = i;
		select.appendChild(opt);
	}
}

function dataAtual(){
	var atual = new Date();
	var dd = atual.getDate();
	var mm = atual.getMonth()+1;
	var yyyy = atual.getFullYear();
	if(dd<10){
		dd = '0'+dd;
	}if(mm<10){
		mm = '0'+mm;
	}
	atual = dd+'/'+mm+'/'+yyyy;
	document.getElementById("txtDataAbertura").value=atual;
}

function populaHoras(){
	// Hora Inicial
	var hini = document.getElementById("hora_inicio");
		var hini1i = new Option("08:00", "08:00");
		var hini2i = new Option("08:30", "08:30");
		var hini3i = new Option("09:00", "09:00");
		var hini4i = new Option("09:30", "09:30");
		var hini5i = new Option("10:00", "10:00");
		var hini6i = new Option("10:30", "10:30");
		var hini7i = new Option("11:00", "11:00");
		var hini8i = new Option("11:30", "11:30");
		var hini9i = new Option("12:00", "12:00");
		var hini10i = new Option("12:30", "12:30");
		var hini11i = new Option("13:00", "13:00");
		var hini12i = new Option("13:30", "13:30");
		var hini13i = new Option("14:00", "14:00");
		var hini14i = new Option("14:30", "14:30");
		var hini15i = new Option("15:00", "15:00");
		var hini16i = new Option("15:30", "15:30");
		var hini17i = new Option("16:00", "16:00");
		var hini18i = new Option("16:30", "16:30");
		var hini19i = new Option("17:00", "17:00");
		var hini20i = new Option("17:30", "17:30");
		var hini21i = new Option("17:48", "17:48");
		var hini22i = new Option("18:00", "18:00");
		var hini23i = new Option("18:30", "18:30");
		var hini24i = new Option("18:48", "18:48");
		
		hini.options[hini.length] = hini1i;
		hini.options[hini.length] = hini2i;
		hini.options[hini.length] = hini3i;
		hini.options[hini.length] = hini4i;
		hini.options[hini.length] = hini5i;
		hini.options[hini.length] = hini6i;
		hini.options[hini.length] = hini7i;
		hini.options[hini.length] = hini8i;
		hini.options[hini.length] = hini9i;
		hini.options[hini.length] = hini11i;
		hini.options[hini.length] = hini12i;
		hini.options[hini.length] = hini13i;
		hini.options[hini.length] = hini14i;
		hini.options[hini.length] = hini15i;
		hini.options[hini.length] = hini16i;
		hini.options[hini.length] = hini17i;
		hini.options[hini.length] = hini18i;
		hini.options[hini.length] = hini19i;
		hini.options[hini.length] = hini20i;
		hini.options[hini.length] = hini21i;
		hini.options[hini.length] = hini22i;
		hini.options[hini.length] = hini23i;
		hini.options[hini.length] = hini24i; 
		
	// Hora Final
	var hfim = document.getElementById("hora_saida");
	var hfim1i = new Option("08:00", "08:00");
	var hfim2i = new Option("08:30", "08:30");
	var hfim3i = new Option("09:00", "09:00");
	var hfim4i = new Option("09:30", "09:30");
	var hfim5i = new Option("10:00", "10:00");
	var hfim6i = new Option("10:30", "10:30");
	var hfim7i = new Option("11:00", "11:00");
	var hfim8i = new Option("11:30", "11:30");
	var hfim9i = new Option("12:00", "12:00");
	var hfim10i = new Option("12:30", "12:30");
	var hfim11i = new Option("13:00", "13:00");
	var hfim12i = new Option("13:30", "13:30");
	var hfim13i = new Option("14:00", "14:00");
	var hfim14i = new Option("14:30", "14:30");
	var hfim15i = new Option("15:00", "15:00");
	var hfim16i = new Option("15:30", "15:30");
	var hfim17i = new Option("16:00", "16:00");
	var hfim18i = new Option("16:30", "16:30");
	var hfim19i = new Option("17:00", "17:00");
	var hfim20i = new Option("17:30", "17:30");
	var hfim21i = new Option("17:48", "17:48");
	var hfim22i = new Option("18:00", "18:00");
	var hfim23i = new Option("18:30", "18:30");
	var hfim24i = new Option("18:48", "18:48");
	var hfim25i = new Option("19:00", "19:00");
	var hfim26i = new Option("19:30", "19:30");
	var hfim27i = new Option("19:48", "19:48");
	var hfim28i = new Option("20:00", "20:00");
	var hfim29i = new Option("20:30", "20:30");
	var hfim30i = new Option("21:00", "21:00");
	var hfim31i = new Option("21:30", "21:30");
	var hfim32i = new Option("22:00", "22:00");
	
	hfim.options[hfim.length] = hfim1i;
	hfim.options[hfim.length] = hfim2i;
	hfim.options[hfim.length] = hfim3i;
	hfim.options[hfim.length] = hfim4i;
	hfim.options[hfim.length] = hfim5i;
	hfim.options[hfim.length] = hfim6i;
	hfim.options[hfim.length] = hfim7i;
	hfim.options[hfim.length] = hfim8i;
	hfim.options[hfim.length] = hfim9i;
	hfim.options[hfim.length] = hfim11i;
	hfim.options[hfim.length] = hfim12i;
	hfim.options[hfim.length] = hfim13i;
	hfim.options[hfim.length] = hfim14i;
	hfim.options[hfim.length] = hfim15i;
	hfim.options[hfim.length] = hfim16i;
	hfim.options[hfim.length] = hfim17i;
	hfim.options[hfim.length] = hfim18i;
	hfim.options[hfim.length] = hfim19i;
	hfim.options[hfim.length] = hfim20i;
	hfim.options[hfim.length] = hfim21i;
	hfim.options[hfim.length] = hfim22i;
	hfim.options[hfim.length] = hfim23i;
	hfim.options[hfim.length] = hfim24i;
	hfim.options[hfim.length] = hfim25i;
	hfim.options[hfim.length] = hfim26i;
	hfim.options[hfim.length] = hfim27i;
	hfim.options[hfim.length] = hfim28i;
	hfim.options[hfim.length] = hfim29i;
	hfim.options[hfim.length] = hfim30i;
	hfim.options[hfim.length] = hfim31i;
	hfim.options[hfim.length] = hfim32i; 
	
	// Almoço inicio
	var aini = document.getElementById("hora_almoco");
	var hora1i = new Option("12:00 - 13:00", "12:00-13:00");
	var hora2i = new Option("13:00 - 14:00", "13:00-14:00");
	aini.options[aini.length] = hora1i;
	aini.options[aini.length] = hora2i;	
}

</script>
<link href="SpryAssets/SpryValidationTextField.css" rel="stylesheet" type="text/css" />
</head>

<body>
<h3>Solicitação de Vaga</h3>
<form action="inserirVaga.php" method="post" id="formInsereVaga" name="formInsereVaga">
  <div>
      Solicitante: <input id="txtSolicitante" name="txtSolicitante" type="text" maxlength="80"/><br />
      Empresa: <input id="txtEmpresa" name="txtEmpresa" type="text" maxlength="80"/><br />
      Cargo: <input id="txtCargo" name="txtCargo" type="text" maxlength="80"/><br />
      Salário:   R$<input id="txtSalario" name="txtSalario" type="text"/><br />
      Cidade: <input id="txtCidade" name="txtCidade" type="text"maxlength="150"/> UF: <input id="txtUF" name="txtUF" type="text" maxlength="2"/>  <br />
      Rota:<select id="slctRota" name="slctRota">
      <?php 
	  	include 'includes/conectionMySql.inc';
		
		$query = "SELECT id,nome FROM `rotas` where id > 0 and aparecer = 1";
		$result = mysql_query($query) or die("Não foi possível executar a Query.".mysql_error());	
		while($row = mysql_fetch_row($result)){
			echo "<option value=".$row[0].">".$row[1]."</option>";
		}		
		mysql_close($db);
		 
	  ?>
      </select><br />
      Tipo de Vaga: <input id="txtTipoVaga" name="txtTipoVaga" type="text" maxlength="100"/><br />
      Data Abertura: <input id="txtDataAbertura" name="txtDataAbertura" type="text" /><br />
      Data de início: <input id="txtDataInicio" name="txtDataInicio" type="text"/><br />
      Dias de trabalho: <input id="txtDiasTrabalho" name="txtDiasTrabalho" type="text"/><br />
    <table border="0">
      <tr>
      	<th></th>
        <th>Horário de Inicio: </th>
        <th>Horário de Saida:</th>
        <th>Horário de Almoço</th>
      </tr>
      <tr>
      	<td>Horário de tabalho:</td>
        <td>
        <select id="hora_inicio" name="hora_inicio"></select></td>
        <td><select id="hora_saida" name="hora_saida"></select></td>
        <td><select id="hora_almoco" name="hora_almoco"></select></td>
      </tr>
    </table>
        

      <br />
  VT: <input id="txtVT" name="txtVT" type="text"/><br />
      VR: <span id="sprytextfield1">
      <input id="txtVR" name="txtVR" type="text"/>
      <span class="textfieldInvalidFormatMsg">Invalid format.</span><span class="textfieldMinValueMsg">The entered value is less than the minimum required.</span><span class="textfieldRequiredMsg">A value is required.</span></span><br />
      Idade: <select id="slctIdade1" name="slctIdadeMin"></select> a <select id="slctIdade2" name="slctIdadeMax"></select><br />
      Sexo: <select id="slctSexo" name="slctSexo">
      			<option value="1" selected="selected">Masculino</option>
                <option value="2">Feminino</option>
                <option value="3">Indiferente</option>
      		</select><br />
  </div>
  <input type="hidden" name="envia" value="1"/>
  <input id="submit" name="submit" type="submit">

</form>

    <p align="center"><a href="index.php">Voltar para menu inicial</a></p>

<script type="text/javascript">
populaIdade("slctIdade1");
populaIdade("slctIdade2");
populaHoras();
jQuery(function($){
	$("#txtDataAbertura").mask("99/99/9999");
	$("#txtDataInicio").mask("99/99/9999");
});
var sprytextfield1 = new Spry.Widget.ValidationTextField("sprytextfield1", "currency", {format:"dot_comma", minValue:"0,00", validateOn:["change"]});
</script>
</body>
</html>